package DynamicProxy;

import Annotation.Aspect;
import Annotation.ServiceA;
import Annotation.ServiceB;

import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @Author shangchao
 * @Date 2020/9/25 21:15
 */
@Aspect({ServiceA.class, ServiceB.class})
public class ServiceLogAspect {

    public static void before(Object object, Method method, Object[] args){
        System.out.println("entering: "
                + method.getDeclaringClass().getSimpleName()
                + "::" + method.getName()
                + ", args: "
                + Arrays.toString(args));

    }

    public static void after(Object object, Method method, Object[] args, Object result){
        System.out.println("leaving: "
                + method.getDeclaringClass().getSimpleName()
                + "::" + method.getName()
                + ", args: "
                + ", result: " + result);
    }
}
